#include "BCIMEssage.h"
#include "string.h"

BCIMessage ComposeMessage(int Kind, int Value, int *pBuffer,int BuffSize)
{
	BCIMessage Ret;
	memset(&Ret,0,sizeof(Ret));
	Ret.Kind = Kind;
	Ret.Value = Value;
	Ret.Check = Kind+Value;
	if(pBuffer != NULL && BuffSize != 0)
	{
		memcpy(&Ret.Buffer[0],pBuffer,BuffSize);
	}
	return Ret;
}

bool CheckMessage(BCIMessage *pMess)
{
	return (pMess->Check == (pMess->Kind + pMess->Value)) ? true : false;
}
